<% status = @platform.ciAttributes.autorepair == 'true' ? 'enabled' : 'disabled'
   enabled = status == 'enabled' %>
<div class="marker">
  <%= status_marker('autorepair', status, state_to_label(status)) %>
</div>
<div class="description">
  <% if has_operations?(@assembly.ciId) %>
    <div class="menu dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span><%= icon('ellipsis-v') %>&nbsp;</span></a>
      <ul class="dropdown-menu" role="menu">
        <% if enabled %>
          <li class="text-error"><%= link_to(icon('wrench', 'Disable autorepair', 'fa-fw'), autorepair_assembly_operations_environment_platform_path(@assembly, @environment, @platform, :status => 'disable'), :method => :put, :remote => true) %></li>
        <% else %>
          <li class="text-success"><%= link_to(icon('wrench', 'Enable autorepair', 'fa-fw'), autorepair_assembly_operations_environment_platform_path(@assembly, @environment, @platform, :status => 'enable'), :method => :put, :remote => true) %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <dl class="dl-horizontal">
    <dt class="text-<%= enabled ? 'success' : 'error' %>"><%= icon('clock-o') %></dt>
    <dd>
      Autorepair <%= highlight(status) %>
      <%= time_ago_in_words(Time.at(@platform_detail.attributes[:attributes].autorepair.updated/1000)) if @platform_detail %>
    </dd>
  </dl>
</div>
